package cn.wsn2018.tools.service;

import cn.wsn2018.tools.model.RsaObj;
import cn.wsn2018.tools.util.JsonUtil;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Service;

@Service
public class RsaKeyService {

    public String getPublickKey(){
        /** 
        * @Description: 获取公钥
        * @Param: [] 
        * @return: java.lang.String 
        * @Author: SongDaisong 
        * @Date:  2020/2/10 17:46
        */ 
        String publicKey = RsaObj.getInstance().getPublicKey();
        String msg =null;
        if(publicKey==null){
            msg=JsonUtil.failedJson("get public key error");
        }else{
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("publicKey",publicKey);
            msg = JsonUtil.successJson("get public key success", jsonObject, null);
        }
        return msg;
    }
}
